package com.mdtx.database.convert;

import java.util.HashMap;
import java.util.Map;

/**
 * oracle和java类型转换
 *
 * @author 猫啊
 * @create 2018-06-13 17:03
 **/
public class OracleConvertToJavaMapping extends JavaMapping{

    private static final String ORACLE_CHAR = "char";
    private static final String ORACLE_NCHAR = "nchar";
    private static final String ORACLE_NVARCHAR2 = "nvarchar2";
    private static final String ORACLE_VARCHAR2 = "varchar2";
    private static final String ORACLE_VARCHAR = "varchar";

    private static final String ORACLE_NUMBER = "number";
    private static final String ORACLE_BINARY_FLOAT = "binary_float";
    private static final String ORACLE_BINARY_DOUBLE= "binary_double";

    private static final String ORACLE_YEAR= "year";
    private static final String ORACLE_MONTH = "month";
    private static final String ORACLE_DAY = "day";
    private static final String ORACLE_HOUR = "hour";
    private static final String ORACLE_MINUTE = "minute";
    private static final String ORACLE_SECOND = "second";
    private static final String ORACLE_DATE = "date";
    private static final String ORACLE_TIMESTAMP  = "timestamp ";
    private static final String ORACLE_BLOB = "blob";
    private static final String ORACLE_CLOB = "clob";
    private static final String ORACLE_NCLOB = "nclob";
    private static final String ORACLE_BFILE = "bfile";
    private static final String ORACLE_LONG= "long";
    private static final String ORACLE_RAW = "raw";




    @Override
    protected Map<String, String> setTypeData() {
        typeMap = new HashMap<String, String>();
        typeMap.put(ORACLE_CHAR,JAVA_CHAR);
        typeMap.put(ORACLE_NCHAR,JAVA_STRING);
        typeMap.put(ORACLE_NVARCHAR2,JAVA_STRING);
        typeMap.put(ORACLE_VARCHAR2,JAVA_STRING);
        typeMap.put(ORACLE_VARCHAR,JAVA_STRING);
        typeMap.put(ORACLE_NUMBER,JAVA_LONG);
        typeMap.put(ORACLE_BINARY_FLOAT,JAVA_FLOAT);
        typeMap.put(ORACLE_BINARY_DOUBLE,JAVA_DOUBLE);
        typeMap.put(ORACLE_YEAR,JAVA_INTEGER);
        typeMap.put(ORACLE_MONTH,JAVA_STRING);
        typeMap.put(ORACLE_DAY,JAVA_STRING);
        typeMap.put(ORACLE_HOUR,JAVA_STRING);
        typeMap.put(ORACLE_MINUTE,JAVA_STRING);
        typeMap.put(ORACLE_SECOND,JAVA_DOUBLE);
        typeMap.put(ORACLE_DATE,JAVA_DATE);
        typeMap.put(ORACLE_TIMESTAMP,JAVA_DATE);
        typeMap.put(ORACLE_BLOB,JAVA_STRING);
        typeMap.put(ORACLE_CLOB,JAVA_STRING);
        typeMap.put(ORACLE_NCLOB,JAVA_STRING);
        typeMap.put(ORACLE_BFILE,JAVA_STRING);
        typeMap.put(ORACLE_LONG,JAVA_STRING);
        typeMap.put(ORACLE_RAW,JAVA_STRING);
        super.setTypeMap(typeMap);
        return typeMap;
    }
}
